package org.su.generalmvc.core;



import org.su.generalmvc.IEditor;
import org.su.generalmvc.annotaion.Permiss;
import org.su.generalmvc.annotaion.RequestMapping;
import org.su.generalmvc.annotaion.ViewType;
import org.su.generalmvc.render.IRender;

import javax.validation.Valid;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * action配置类，将每一个控制器(含有@RequestMapping注解的方法)所有配置信息封装到该类中，方便ActionProxy调用
 * @author yangchuan
 * @since 2012-03-6
 * @version 1.0
 * @see ActionProxy
 */
public class ActionConfig {
    
	/**
	 * 得到action参数编辑器列表
	 * @return
	 */
	public IEditor[] getParamBinds() {
		return paramBinds;
	}


	/**
	 * 拦截器堆栈
	 */
	private List<Interceptor> interceptors ;
	
	private IEditor[] paramBinds;
	private String[] paramNames;

	
	/**
	 * action RequestMapping配置
	 */
	private RequestMapping rm;
	
	/**
	 * 复合类型参数预设置
	 */
	private Map<String, Class<?>> beanParams = new HashMap<String, Class<?>>();
	
	
	/**
	 * 权限验证方式
	 */
	private Permiss permiss;
	
	
	/**
	 * 控制器名称
	 */
	private String controllerName;
	
	/**
	 * 事物级别
	 */
	private int transLeavel = 0;
	
	/**
	 * 正常处理结果
	 */
	private IRender render;
	
	/**
	 * 异常处理结果
	 */
	private IRender excptionRender;
	
	/**
	 * 视图类型
	 */
	private ViewType viewType;
	
	private String defaultViewPath;
	
	
	public String getControllerName() {
		return controllerName;
	}

	public void setControllerName(String controllerName) {
		this.controllerName = controllerName;
	}

	public Permiss getPermiss() {
		return permiss;
	}

	public void setPermiss(Permiss permiss) {
		this.permiss = permiss;
	}

	public Map<String, Class<?>> getBeanParams() {
		return beanParams;
	}

	public void setParamBinds(IEditor[] paramBinds) {
		this.paramBinds = paramBinds;
	}
	
	/**
	 * 得到action参数名称列表
	 * @return 返回action参数名称列表
	 */
	public String[] getParamNames() {
		return paramNames;
	}
	
	public void setParamNames(String[] paramNames) {
		this.paramNames = paramNames;
	}

	/**
	 * 获取拦截器事务级别
	 * @return 获取拦截器事务级别
	 */
	public int getTransLeavel() {
		return transLeavel;
	}

	public void setTransLeavel(int transLeavel) {
		this.transLeavel = transLeavel;
	}

	
	
	
	/**
	 * action视图渲染器
	 * @return
	 */
	public IRender getRender() {
		return render;
	}

	public void setRender(IRender render) {
		this.render = render;
	}

	/**
	 * 得到action异常渲染器
	 * @return 得到action异常渲染器
	 */
	public IRender getExcptionRender() {
		return excptionRender;
	}

	public void setExcptionRender(IRender excptionRender) {
		this.excptionRender = excptionRender;
	}

	/**
	 * 获取action RequestMapping配置信息
	 * @return 获取action RequestMapping配置信息
	 */
	public RequestMapping getRm() {
		return rm;
	}

	public void setRm(RequestMapping rm) {
		this.rm = rm;
	}

	/**
	 * 得到默认的视图路径
	 * @return 得到默认的视图路径
	 */
	public String getDefaultViewPath() {
		return defaultViewPath;
	}

	public void setDefaultViewPath(String defaultViewPath) {
		this.defaultViewPath = defaultViewPath;
	}

	/**
	 * 得到action视图类型
	 * @return 得到action视图类型
	 */
	public ViewType getViewType() {
		return viewType;
	}

	public void setViewType(ViewType viewType) {
		this.viewType = viewType;
	}

	/**
	 * 得到action的拦截器列表
	 * @return action拦截器列表
	 */
	public List<Interceptor> getInterceptors() {
		return interceptors;
	}

	public void setInterceptors(List<Interceptor> interceptors) {
		this.interceptors = interceptors;
	}

	public ActionConfig() {
		interceptors = new ArrayList<Interceptor>();
	}
	
	
	
	
}
